#include <iostream>
using namespace std;

typedef long long LL;

const int N = 1e6 + 10;

LL n, m;
LL a[N];

LL clac(LL x)
{
	LL ret = 0;
	for (int i = 1; i <= n; i++)
	{
		if (a[i] > x)    ret += a[i] - x;
	}
	return ret;
}

int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)	cin >> a[i];

    LL left = 1, right = 2e9;
    while (left < right)
    {
    	LL mid = (left + right + 1) / 2;
		if (clac(mid) >= m)	left = mid;
		else right = mid - 1; 
	}
	
	cout << left << endl;
	
	return 0;
}
